package com.yex.controller.modify.article;

import com.yex.common.exception.RRException;
import com.yex.common.utils.R;
import com.yex.entity.ArticleEntity;
import com.yex.service.impl.ArticleService;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/appApi/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @GetMapping("list")
    public R list() {
        return R.okData(articleService.list());
    }

    @GetMapping("detail")
    public R detail(Integer id) {
        if (id == null) throw new RRException("无效的参数ID");
        return R.okData(articleService.detail(id));
    }

}
